import { Injectable } from "@nestjs/common";

//这是一个可以注入的provider
@Injectable()
export class StudentsService{
   //模拟数据库存储用户数据
   private users=[
    {
        id:1,
        name:'zhangsan'
    },
    {
        id:2,
        name:'lisi'
    }
   ]
   //获取所有的用户
   findAll(){
    return this.users;
   }
   findOne(id:number){
    return this.users.find(user=>user.id===id);
   }
}